package com.corecloud.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corecloud.entity.SysDepartmentEntity;
import com.corecloud.mapper.mysql.SysDepartmentMapper;
import com.corecloud.service.SysDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("sysDepartmentService")
public class SysDepartmentServiceImpl implements SysDepartmentService {
    @Autowired
    private SysDepartmentMapper sysDepartmentMapper;

    @Override
    public Page<SysDepartmentEntity> getInfoByPage(Page page, QueryWrapper<SysDepartmentEntity> qw) {
        return sysDepartmentMapper.selectPage(page,qw);
    }

    @Override
    public String findNameById(long id) {
        return sysDepartmentMapper.selectById(id).getName();
    }

    @Override
    public List<SysDepartmentEntity> getAll() {
        return sysDepartmentMapper.selectList(new QueryWrapper<>());
    }
}
